package br.com.ufc.apsoo.hotelar.utils;

import java.util.Calendar;
import java.util.Date;

public class Utils {
	public static Date getDataMesAnterior() {
		Date dt = new Date();
		Calendar ca = Calendar.getInstance();
		ca.setTime(new Date());
		Integer ano = Calendar.YEAR;
		if(ca.get(Calendar.MONTH) == 0) {
			ca.set(Calendar.MONTH, 11);
			ca.set(Calendar.YEAR, ano - 1);
		}
		else {
			ca.set(Calendar.MONTH, ca.get(Calendar.MONTH) - 1);
		}
		dt = ca.getTime();
		return dt;
	}

}
